﻿using Microsoft.Office.Interop.Visio;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tvsd
{
    class Program
    {
        static void Main(string[] args)
        {

            Microsoft.Office.Interop.Visio.Application m_app = new Microsoft.Office.Interop.Visio.Application();
            try
            {
                String zdhmjPath = @"C:\Users\lhzxd\Documents\我的形状\zdhmj.vss";
              
                var m_doc = m_app.Documents.Add("");

                m_doc.Saved = true;

                m_doc = m_app.Documents.OpenEx("Basic Shapes.vss", (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked);
                var m_doc_zdh = m_app.Documents.OpenEx(zdhmjPath, (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked);
                var m_master = m_doc_zdh.Masters.get_ItemU("FireWall");
                var m_page = m_app.ActivePage;

                float x = (float)(1);
                float y = (float)(m_page.Document.PaperHeight[0] - 2);
                Shape m_sp = m_page.Drop(m_master, x, y);
                var doc = m_app.ActiveDocument;
                doc.SaveAs("D:\\aaaa.vsd");
            }
            finally
            {
               m_app.Quit();
            }
        }
    }
}
